<button class="btn btn-success btn-sm" data-toggle="modal" data-target="#contractedCustomer">新增</button>

<div class="modal fade" id="contractedCustomer" tabindex="-1" role="dialog" aria-labelledby="exampleModal2" aria-hidden="true">
    <div class="modal-dialog modal-xs">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="font-size: 36px;">&times;</button>
                <h4 class="modal-title" id="myModalLabel">新增</h4>
            </div>
            <div class="modal-body">
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">合同编号</label>
                    <input type="text" name="contractNo" class="form-control" placeholder="请输入合同编号">
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">男方姓名</label>
                    <input type="text" name="maleName" class="form-control" placeholder="请输入男方姓名">
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">男方血型</label>
                    <select name="maleBloodType" class="form-control">
                        @foreach(__('contracted_customer.bloodTypeArr') as $key => $value)
                            <option value="{{ $key }}">{{ $value }}</option>
                        @endforeach
                    </select>
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">手机号</label>
                    <input type="text" name="maleMobile" maxlength="11" class="form-control" placeholder="请输入手机号">
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">女方姓名</label>
                    <input type="text" name="femaleName" class="form-control" placeholder="请输入女方姓名">
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">女方血型</label>
                    <select name="femaleBloodType" class="form-control">
                        @foreach(__('contracted_customer.bloodTypeArr') as $key => $value)
                            <option value="{{ $key }}">{{ $value }}</option>
                        @endforeach
                    </select>
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">手机号</label>
                    <input type="text" name="femaleMobile" maxlength="11" class="form-control" placeholder="请输入手机号">
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">地址</label>
                    <input type="text" name="contactAddress" class="form-control" placeholder="请输入地址">
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">合同金额</label>
                    <div class="input-group">
                        <div class="input-group-addon">$</div>
                        <input type="number" name="contractAmount" class="form-control" placeholder="请输入合同金额">
                    </div>
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">冷冻日期</label>
                    <input type="date" name="freezeDate" formate="" class="form-control" placeholder="请输入冷冻日期">
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">备注</label>
                    <textarea name="remark" class="form-control" placeholder="请输入备注"></textarea>
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">业务员</label>
                    <select name="operatorId" class="form-control">
                        @if(!empty($users))
                            @foreach ($users as $value)
                                <option value="{{ $value['user_id'] }}">{{ $value['name'] }}</option>
                            @endforeach
                        @endif
                    </select>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" onclick="contractedCustomerCreate()">提交</button>
            </div>
        </div>
    </div>
</div>
<script>
    function contractedCustomerCreate()
    {
        ajaxPostFunc('/admin/ajax/contractedCustomerCreate', {
            contract_no: $("input[name='contractNo']").val(),
            male_name: $("input[name='maleName']").val(),
            male_blood_type: $("select[name='maleBloodType']").val(),
            male_mobile: $("input[name='maleMobile']").val(),
            female_name: $("input[name='femaleName']").val(),
            female_blood_type: $("select[name='femaleBloodType']").val(),
            female_mobile: $("input[name='femaleMobile']").val(),
            contact_address: $("input[name='contactAddress']").val(),
            contract_amount: $("input[name='contractAmount']").val(),
            freeze_date: $("input[name='freezeDate']").val(),
            remark: $("textarea[name='remark']").val(),
            operator_id: $("select[name='operatorId']").val(),
            _token: $.admin.token
        }, {}, res => {
            console.log(res);
            window.location.reload();
        });
    }
</script>
